import request from '@/utils/request'
import {parseStrEmpty} from '@/utils/ruoyi'

// 查询用户列表
export function listUser(query) {
    return request({
        url: '/customer/v1/agent/page',
        method: 'post',
        data: query
    })
}

// 查询用户详细
export function getUser(agentId) {
    return request({
        url: '/customer/v1/agent/' + parseStrEmpty(agentId),
        method: 'get'
    })
}

// 新增用户
export function addUser(data) {
    return request({
        url: '/customer/v1/agent?google_code=' + data.google_code,
        method: 'post',
        data: data
    })
}

// 修改用户
export function updateUser(data) {
    return request({
        url: '/customer/v1/agent?google_code=' + data.google_code,
        method: 'put',
        data: data
    })
}

// 用户密码重置
export function resetUserPwd(id, password, google_code) {
    const data = {
        id,
        password
    }
    return request({
        url: '/uc/v1/reset_pwd/agent?google_code=' + google_code,
        method: 'post',
        data: data
    })
}
